package com.twu.biblioteca;

/**
 * User: akerber
 * Date: 2/7/13
 * Time: 4:47 PM
 */
public class Authenticator {

    private UsersRepository usersRepository;
    private UserSession userSession;

    public Authenticator(UsersRepository usersRepository,UserSession userSession){

        this.usersRepository = usersRepository;
        this.userSession = userSession;
    }

    public boolean authenticate(User user){
        if(usersRepository.containsUser(user)){
            userSession.login(user);
            return true;
        }  else return false;


    }
}
